<!DOCTYPE html>
<#assign dicSelect=JspTaglibs["http://www.casic304.cn/dicSelect"] />
<#assign secSelect=JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />

<head>
    <meta charset="utf-8">
    <title>质量信得过班组申报基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .qbdms-TBinformation {
            margin-left: 0;
            font-size: 15px
        }

        .qbdms-TBinformationText {
            margin-left: 145px;
        }
    </style>
</head>

<body class="listBody">
    <div class="qbdms-backDiv">
     <div class="layui-table-view-body" style="padding: 0 24px 24px;">
        <div class="qbdms-formTitle" style="border-bottom: 1px solid #E5F0FF">质量信得过班组申报<i class="qbdms-returnOn closeWindow">返回</i></div>
        <form class="layui-form treeFormPreview"  requrl="${ctx}/qbdms/wQbdQualityteamDec/get" lay-filter="wQbdQualityteamDecDataForm">
            <@fillDept.dept id="tbxx"/>
            <div class="layui-row">
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </div>
                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="班组名称">班组名称<span style="color: red;">*</span></label>
                        <button type="button" class="layui-btn qbdms-twoBtn" id="selectGroupnameBtn" style="float: right">选择</button>
                        <div class="layui-input-block qbdms-input qbdms-inputIsButton">
                            <input type="text" placeholder="请选择" autocomplete="off" class="layui-input textInput" lay-verify="required" lay-reqtext="班组名称是必填项" name="teamname" maxlength="50" readonly>
                        </div>
                        <input type="hidden" name="groupleader" placeholder="组长"
                               autocomplete="off" class="layui-input  textInput getIds"
                               maxlength="100" fieldname="groupleader">

                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="年度">年度<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请选择" autocomplete="off" class="layui-input dateTimeFiled input-right time-init year" name="year" maxlength="7"  lay-verify="required" lay-reqtext="年度是必填项" >
                        </div>
                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="申报类别">申报类别<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="sblb" maxlength="50" lay-verify="required" lay-reqtext="申报类别是必填项" readonly>
                        </div>
                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="半年">半年<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="halfyear" nodeKey="bn" css="layui-input textInput" verify="required" reqtext="半年是必填项" />
                        </div>
                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="等级">等级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="grade" nodeKey="dj" css="layui-input textInput" verify="required" reqtext="等级是必填项" />
                        </div>
                    </div>
                    <div style="width: 65%">
                        <label class="layui-form-label qbdms-label" title="班组人数">班组人数<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="teamsize" maxlength="50" lay-verify="required" lay-reqtext="班组人数是必填项"  readonly>
                        </div>
                    </div>
                <div style="width: 65%">
                    <label class="layui-form-label qbdms-label" title="班组人数">单位<span style="color: red;">*</span></label>
                    <div class="layui-input-block qbdms-input">
                        <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="company" maxlength="50" lay-verify="required" lay-reqtext="单位是必填项"  readonly>
                    </div>
                    <input type="hidden" name="deptId" placeholder="单位ID"
                           autocomplete="off" class="layui-input  textInput getIds"
                           maxlength="100" fieldname="deptId">
                </div>
                    <div style="width: 76%">
                        <label class="layui-form-label qbdms-label" title="曾获院信得过职工人员">曾获院信得过职工人员</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea type="text" name="chyxdgzgry" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="1000" style="min-height:64px;padding-top: 5px"></textarea>

                        </div>
                    </div>
                            <div style="width: 76%">
                                <label class="layui-form-label qbdms-label" title="贡献点">贡献点</label>
                                <div class="layui-input-block qbdms-input">
                                    <textarea type="text" name="contributionpo" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="1000" style="min-height:64px;padding-top: 5px"></textarea>
                                </div>
                            </div>
                            <div style="width: 76%">
                                <label class="layui-form-label qbdms-label" title="备注">备注</label>
                                <div class="layui-input-block qbdms-input">
                                    <textarea type="text" name="remarks" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="1000" style="min-height:64px;padding-top: 5px"></textarea>
                                </div>
                            </div>
                            <div style="width: 76%">
                                <label class="layui-form-label qbdms-label" title="报告文件上传">报告文件上传</label>
                                <div class="layui-input-block qbdms-input">
                                    <input type="button" class="layui-btn iconfont iconupload fileUpload qbdms-fileUp" value="上传附件"/>
                                    <i class="qbdms-fileUpText">支持多个附件上传，附件格式：doc docx pdf，文件大小限制不超过100M</i>
                                    <input type="text" id="enclosure" class="uploadInput" name="enclosure" style="display: none">
                                    <div class="uploadFileList" fileUploadName="enclosure" style="padding-top: 9px;"></div>
                                </div>
                            </div>
            </div>
            <div class="layui-hide">
                <input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input " maxlength="50" fieldname="id">
                <!--                <input type="text" name="fTrialdeptnameid" placeholder="请输入受审核部门名称ID" autocomplete="off" class="layui-input " maxlength="50" fieldname="fTrialdeptnameid">-->
            </div>
            <div class="layui-form-item btnformItem">
                <p>
                        <span id="hideAndShow" style="display: none;">
                            <a lay-submit lay-filter="wQbdQualityteamDec" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="${ctx}/qbdms/wQbdQualityteamDec/save">提交</a>
                        </span>
                    <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消</button>
                </p>
            </div>
        </form>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'propsHandle', 'upload', 'common', 'laydate', 'jquery', 'publicMethods', 'qbdmsForm', 'commonDialog'], function () {
        var $ = layui.jquery,
            laydate = layui.laydate,
            commonDialog = layui.commonDialog,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            common = layui.common,
            propsHandle = layui.propsHandle,
            upload = layui.upload,
            publicMethods = layui.publicMethods,
            formId = '' || '',
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                initCss: [
                    'style/currencyCss'
                ],
                // formAreaInfo:'.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn',
            },
            temQuery = new propsHandle(),  // 实例化模板功能部分
            form = layui.qbdmsForm;
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        $(".subContTem").hide()
        // 子表初始化事件
        temQuery.initSubEvent(defProps, serverPath, setter);
        var dateTimeFiledLen = $(".dateTimeFiled");
        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'year'
                , trigger: 'click'
            });
        }
        //下载附件
        window.downFile = function (obj) {
            var fileId = $(obj).parents("span").attr("fileId");
            window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
        }

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdQualityteamDec/view/list';
        });
        var id = "${id}";
        var runId = "${runId}";
        if(runId == null || runId == ''){
            $("#hideAndShow").show();
        }

        var common = layui.common;
        var index = parent.layer.getFrameIndex(window.name);
        var secSelect = '<@secSelect.sec_select data_src=1 hasBlank=false/>'
        common.uploadfun(".fileUpload", {
            acceptMime:'application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            exts: 'doc|docx|pdf',
            secSelect: secSelect,
            isSub: false,
            upLoadSize: 102400,
            upLoadNumber: 10,
            isMultiFile: true
        });
        common.updateForm({
            name:'wQbdQualityteamDecDataForm',
            idValue:"${id}",
            primary:"id",
            beforeSubmitFun: function (data) {
                console.log(data)
                var newD = data.field.year;
                data.field.year = new Date(newD);
                //- 附件密级不能高于表单密级 开始 ------------------------------------------------------
                var selectMaxVal = 0;
                var formSecretVal = $("[name='secret']").val();
                $(".fileSecLevel select").each(function () {
                    selectMaxVal = selectMaxVal >= $(this).val() ? selectMaxVal : $(this).val();
                });

                if (selectMaxVal > formSecretVal) {
                    layer.msg('附件密级不能高于表单密级。', {icon: 5});
                    return false;
                }
                //- 附件密级不能高于表单密级 结束 ------------------------------------------------------
                $(".uploadFileList").each(function (i, v) {
                    common.constructFileStr(v)
                });
                var files=[];
                //整理上传附件的隐藏域，将提交的字符串转为json对象
                $(".uploadInput").each(function () {
                    var uploadName = $(this).attr("name");
                    if (!$(this).val()) {
                        return;
                    }
                    data.field[uploadName] = eval($(this).val());
                    files=files.concat(eval($(this).val()));
                });

                return common.setFileLevel(files);

            },
            getCallback: function (data) {
                $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
              //-修改页面 初始化附件组件 开始 ------------------------------------------
              $('.uploadFileList').each(function () {
                var fileUploadName = $(this).attr("fileUploadName");
                var jsonFile = data.data[fileUploadName];
                var files = eval(jsonFile);

                if (files) {
                  for (var i = 0; i < files.length; i++) {
                    var fileLevel = files[i].fileLevel;
                    var fileLevelText = files[i].fileLevelText;
                    var fileSec = '<div class="fileSecLevel layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                    var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont data-iconcommon_fujian" style="margin-right: 5px"></i>' + files[i].fileName + '</span><i class="iconfont data-iconcommon_close deleteFile" ></i></span>';
                    $(this).append(newStr);
                    $(this).find("select:last").val(fileLevel);
                  }
                }
              });
              //-修改页面 初始化附件组件 结束 ------------------------------------------

            },
            updateCallback:function (data) {
                if (publicMethods._filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'}, function (index) {
                        layer.close(index);

                            window.location.href = '${ctx}/qbdms/wQbdQualityteamDec/view/list';
                    });
                } else {
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'});
                }
                return false;
            }
        });
        //-- 选择器 开始 --------------------------------------------------------------
        $("#selectGroupnameBtn").click(function () {
            var paramValueString = "";
            commonDialog.CommonDialog("bzmcxzq", function (data, selectIds) {
                var dataObj = JSON.parse(data);
                console.log(dataObj)
                var teamsize = dataObj.TEAMCOUNT,  //人数
                    company = dataObj.TEAMDEPT,  //单位
                    teamname = dataObj.TEAMNAME, //班组名称
                    sblb=dataObj.DECLARES,
                    groupleader=dataObj.TEAM_LEADER_NAME,
                    deptId = dataObj.TEAMDEPTID;//单位代码
                //对象赋值
                $("input[name='teamsize']").val(teamsize);
                $("input[name=company]").val(company);
                $("input[name=teamname]").val(teamname);
                $("input[name='deptId']").val(deptId);
                $("input[name='groupleader']").val(groupleader);
                $("input[name='sblb']").val(sblb);

            }, paramValueString);
        });
        //-- 选择器 结束 --------------------------------------------------------------
        publicMethods.bottomFixd()
        form.on('select', function (data) {
            publicMethods.bottomFixd()
        });
        form.render();
    });
</script>
</body>
</html>